<?php

namespace app\proxy\controller;

use app\common\model\settings\Setting as SettingModel;
use app\proxy\model\proxy\Region;
use app\supplier\service\ShopService;
use app\Request;

class Index extends Controller
{
    public function base()
    {
        $config = SettingModel::getSysConfig();
//        $service = new ShopService($this->getSupplierId());
//        $supp = $service->getSupplierDetal();
        $settings = [
            'supplier_name'   => $config['supplier_name'],
            'supplier_bg_img' => $config['supplier_bg_img'],
            //            'supplier' => $supp
        ];
        return $this->renderSuccess('', compact('settings'));
    }


    public function index()
    {
        $service = new ShopService($this->getProxyId());
        return $this->renderSuccess('', ['data' => $service->getHomeData()]);
    }


    /**
     * 获取代理区域列表
     * @return \think\response\Json
     * @Author joey
     * @date 2024/3/28 11:17
     */
    public function getProxyRegionList(Request $request)
    {
        $where = $request->param();
        $getlvs = isset($where['glv'])?false:true;
        $regions = Region::regionListOptions($this->getProxyId(),false,$getlvs);
        return $this->renderSuccess('', compact('regions'));
    }
}